/**
 * Copyright 2013 yangming.liu<liuyangming@gmail.com>.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, see <http://www.gnu.org/licenses/>.
 */
package org.bytesoft.openjta.supports.internal;

import java.util.HashSet;
import java.util.Set;

import org.bytesoft.openjta.archive.TerminatorArchive;
import org.bytesoft.openjta.archive.TransactionArchive;
import org.bytesoft.openjta.archive.XAResourceArchive;
import org.bytesoft.openjta.supports.TransactionLogger;

public class TransactionLoggerImpl implements TransactionLogger {
	private TransactionLogger delegate = TransactionLogger.defaultTransactionLogger;

	public void createTransaction(TransactionArchive transactionAchive) {
		delegate.createTransaction(transactionAchive);
	}

	public void completePreparePhase(TransactionArchive transactionAchive) {
		delegate.completePreparePhase(transactionAchive);
	}

	public void enterCommitPhase(TransactionArchive transactionAchive) {
		delegate.enterCommitPhase(transactionAchive);
	}

	public void enterRollbackPhase(TransactionArchive transactionAchive) {
		delegate.enterRollbackPhase(transactionAchive);
	}

	public void completeCommitPhase(TransactionArchive transactionAchive) {
		delegate.completeCommitPhase(transactionAchive);
	}

	public void completeRollbackPhase(TransactionArchive transactionAchive) {
		delegate.completeRollbackPhase(transactionAchive);
	}

	public void cleanupTransaction(TransactionArchive transactionAchive) {
		delegate.cleanupTransaction(transactionAchive);
	}

	public void enterPrepareXAResource(XAResourceArchive archive) {
		delegate.enterPrepareXAResource(archive);
	}

	public void completePrepareXAResource(XAResourceArchive archive) {
		delegate.completePrepareXAResource(archive);
	}

	public void enterCommitXAResource(XAResourceArchive archive) {
		delegate.enterCommitXAResource(archive);
	}

	public void completeCommitXAResource(XAResourceArchive archive) {
		delegate.completeCommitXAResource(archive);
	}

	public void enterRollbackXAResource(XAResourceArchive archive) {
		delegate.enterRollbackXAResource(archive);
	}

	public void completeRollbackXAResource(XAResourceArchive archive) {
		delegate.completeRollbackXAResource(archive);
	}

	public void enterPrepareTerminator(TerminatorArchive terminatorAchive) {
		delegate.enterPrepareTerminator(terminatorAchive);
	}

	public void completePrepareTerminator(TerminatorArchive terminatorAchive) {
		delegate.completePrepareTerminator(terminatorAchive);
	}

	public void enterCommitTerminator(TerminatorArchive terminatorAchive) {
		delegate.enterCommitTerminator(terminatorAchive);
	}

	public void completeCommitTerminator(TerminatorArchive terminatorAchive) {
		delegate.completeCommitTerminator(terminatorAchive);
	}

	public void enterRollbackTerminator(TerminatorArchive terminatorAchive) {
		delegate.enterRollbackTerminator(terminatorAchive);
	}

	public void completeRollbackTerminator(TerminatorArchive terminatorAchive) {
		delegate.completeRollbackTerminator(terminatorAchive);
	}

	public void cleanupTerminator(TerminatorArchive terminatorAchive) {
		delegate.completeRollbackTerminator(terminatorAchive);
	}

	public Set<TransactionArchive> getRecoveryArchives() {
		Set<TransactionArchive> recoveryArchives = delegate.getRecoveryArchives();
		if (recoveryArchives == null) {
			return new HashSet<TransactionArchive>();
		} else {
			return recoveryArchives;
		}
	}

	public void setDelegate(TransactionLogger delegate) {
		this.delegate = delegate;
	}

}
